<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>ajax</title>
    <!-- 一定要引入 editormd 的依赖, 才能使用这里的方法 -->
    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
</head>
<body>

账户：<input type="text" id="username" name="username">
密码：<input type="password" id="password" name="password">
<input type="button" id="submit" value="提交">


</body>

<script>
    $("#submit").click(function (){
        var name=$("#username").val()
        var password=$("#password").val()
        $.ajax({
            type:"get",
            url:"a",//JSON.stringify(
            data:{'username':name,'password':password},
            //dataType:"json",
            success:function (body)
            {
                alert(body.massage);
            }
        })


        $.post("a", {'username':name,'password':password},
            function (body) {
              alert(body.massage);
             }
        )

        $.get("a", {'username':name,'password':password},
            function (body) {
                alert(body.massage);
            }
        )
    })




</script>
</html>